package org.tloss.web.editor.model.oper.math;

import javax.xml.bind.annotation.XmlElement;

import org.tloss.web.editor.model.Param;
import org.tloss.web.editor.utils.Constants;

public class ParamOparand extends MathOperand {

	private Param param;

	@XmlElement
	public Param getParam() {
		return param;
	}

	public void setParam(Param param) {
		this.param = param;
	}

	@Override
	public String getDisplayText() {
		String name = null;
		if (param != null) {
			name = param.getName();
		}
		return ":" + name;
	}

	@Override
	public String generate(int type, Object[] param) {
		if (type == Constants.CodeType.JAVA) {
			// TODO: get param name
		} else if (type == Constants.CodeType.JAVA) {
			return getDisplayText();
		}
		return null;
	}

	@Override
	public String getType() {
		return param.getType();
	}
}
